<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>菜单管理</title>
<style type="text/css">
#menu{
    border-width: medium 1px 1px medium;
    border-style: none solid solid none;
    border-color: -moz-use-text-color #ACACAC #ACACAC -moz-use-text-color;
    -moz-border-top-colors: none;
    -moz-border-right-colors: none;
    -moz-border-bottom-colors: none;
    -moz-border-left-colors: none;
    border-image: none;
    padding: 2px 5px;
    background: url('/adminweixin/static/images/allbtbg2.gif') repeat scroll 0% 0% #EFF7D0;
    cursor: pointer;
	width:60px;
	text-align:center;
}
</style>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="static/style/admin.css" rel="stylesheet" type="text/css" />
<link href="static/style/tb-box.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="static/js/j.js"></script>
<script type="text/javascript" src="static/js/box.js"></script>
<script type="text/javascript">
function del(id)
{
    if(id <= 0)
    {
        var msg = "没有选择正确信息";
		msg += "<br/><a href='javascript:tb_remove();'>&lt;&lt;点错了</a> &nbsp;";
		tb_showmsg(msg);  
    }else{
        var msg = "<font color='red'>如果删除一级菜单将同时删除其子菜单，且不能恢复操作，请确认删除！</font>";
        msg += "<br/><a href='javascript:tb_remove();'>&lt;&lt;点错了</a> &nbsp;|&nbsp; <a href='?ct=asktype&ac=delete&id="+id+"'>确定要删除&gt;&gt;</a>";
    }
    
    tb_showmsg(msg);
}
</script>
</head>
<?php
$menudata='';
$startmenu='{"button":[';
$endmenu=']}';
$menustr='';
foreach($asktypes as $asktype){
if(empty($asktype['son'])){
	if (!empty($asktype['url'])){
		$menustr.= '{"type":"view","name":"'.$asktype['name'].'","url":"'.$asktype['url'].'"},';
	}else{
		$menustr.= '{"type":"click","name":"'.$asktype['name'].'","key":"'.$asktype['keywords'].'"},';
	}
}else{
	$menustr.='{"name":"'.$asktype['name'].'","sub_button":['.substr($asktype['sonstr'],0,-1).']},';
}
}
	$menudata=substr($menustr,0,-1);
	$wxmenu = $startmenu.$menudata.$endmenu;
    //echo $wxmenu;
?>

<body background='img/allbg.gif' leftmargin='8' topmargin='8'>
<div class="bodytitle">
	<div class="bodytitleleft"></div>
    <div class="bodytitletxt"  style="padding-left:10px;"><b>微信接口</b> -- 菜单管理</div>
</div>
<form name="form3" action="?ct=asktype&ac=update" method="post">
<table width="98%" border="0" cellpadding="0" cellspacing="1" align="center" style="background:#cfcfcf;">
      <tr>
        <td height="26" bgcolor="#EDF9D5" background="static/images/tbg.gif" style="padding-left:10px;"><strong style="float:left;">&nbsp;编辑菜单</strong><span style="float:right;padding-right:10px;"><a href='?ct=asktype&ac=add&amp&height=220&amp;width=550' class="thickbox">增加菜单</a></span></td>
    </tr>
      <tr>
        <td>
        <table width="100%" border="0" cellpadding="5" cellspacing="1" align="center" style="margin:0px auto;background:#ffffff;">
          <tr height="35" bgcolor="#4A8228" style="color:#FFF;">
            <td width="14%">菜单名称</td>
            <td width="14%">关键词</td>
            <td width="54%">链接地址</td>
            <td width="4%">排序</td>
            <td width="14%" align="center">管理操作</td>
          </tr>
         <?php
         foreach($asktypes as $asktype){
         ?>
          <tr bgcolor="#FDFEDE">
                <td><?php echo $asktype['name'];?></td>
                <td><?php echo $asktype['keywords'];?></td>
                <td><?php echo $asktype['url'];?></td>
                <td><input style="background:#FFF; border:1px solid #CCC;" name="disorders[<?php echo $asktype['id'];?>]" type="text" value="<?php echo $asktype['disorder'];?>" size="5" /></td>
                <td align="center"><a href="?ct=asktype&amp;ac=add&amp;name=<?php echo $asktype['name'];?>&id=<?php echo $asktype['id'];?>&amp&height=220&amp;width=550" class="thickbox">添加子菜单</a> <a href='?ct=asktype&ac=edit&amp;id=<?php echo $asktype['id'];?>&height=230&amp;width=570' class="thickbox">修改</a> <a href='#' onClick="javascript:del(<?php echo $asktype['id'];?>)">删除</a></td>
          </tr>
         <?php if(!empty($asktype['son'])) echo $asktype['son']; }?>
        </table> 
       </td>
      </tr>
      <tr>
        <td height="30" style="padding-right:10px;" align="right" bgcolor="#F8FCF1"><table width="100%" border="0">
          <tr>
            <td><div id="menu"><a href=/jianli/menu.php?menu=<?php echo $wxmenu; ?>>生成菜单</a></div></td>
            <td align="right"><input name="submit3" type="submit" value="更新排序" class="np coolbg"/></td>
          </tr>
        </table></td>
      </tr>
    </table>
</form>
</body>
</html>
